import 'package:fluent_ui/fluent_ui.dart';
import 'package:flutter/foundation.dart';
import 'package:window_manager/window_manager.dart';

import './my_app.widget.dart';

// import 'package:flutter_acrylic/flutter_acrylic.dart';

/// Checks if the current environment is a desktop environment.
bool get isDesktop {
  if (kIsWeb) {
    return false;
  }

  return [
    TargetPlatform.windows,
    TargetPlatform.linux,
    TargetPlatform.macOS,
  ].contains(defaultTargetPlatform);
}

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  if (isDesktop) {
    await windowManager.ensureInitialized();
    // await Window.initialize();

    const windowOptions = WindowOptions(
      title: 'My App Home',
      size: Size(1046, 616),
      minimumSize: Size(600, 400),
      center: true,
    );

    windowManager.waitUntilReadyToShow(windowOptions, () async {
      await windowManager.show();
      await windowManager.focus();
    });
  }

  runApp(const MyApp());
}
